import React, { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'
import { getDetail } from '../../api'
import { Tabs } from 'antd';
import { statusEnum } from '../../enum'

const { TabPane } = Tabs;

const Detail = () => {

    const params = useParams()

    const [userInfo, setUserInfo]:any = useState({})

    useEffect(() => {
        getDetailData()
    }, [])

    const getDetailData = () => {
        getDetail({ id: params.id }).then(res => {
            setUserInfo(res.data)
        })
    }



    return <Tabs defaultActiveKey="1" >
        <TabPane tab="订单详情" key="1">
            <div>
                姓名：{userInfo.name}
            </div>
        </TabPane>
        <TabPane tab="收货与物流信息" key="2">
            订单状态：{statusEnum[userInfo.status]}
        </TabPane>
    </Tabs>
}

export default Detail